﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace S.PregnancyTest.Infrastructure
{
    public interface IBaseRepository<T>
    {
        #region 同步操作

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        bool Add(T t);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Delete(int id);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        bool Update(T t);

        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();

        /// <summary>
        /// 批量添加数据
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        bool AddAll(List<T> t);


        #endregion


        #region 异步操作

        /// <summary>
        /// 异步添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<bool> AddAsync(T t);

        /// <summary>
        /// 异步修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<bool> UpdateAsync(T t);

        /// <summary>
        /// 异步删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> DeleteAsync(int id);

        /// <summary>
        /// 异步查询显示
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAllAsync();

        /// <summary>
        /// 异步批量添加数据
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<bool> AddAllAsync(List<T> t);


        #endregion

    }
}
